package com.java1412.goods.controller;

import com.java1412.goods.service.GoodsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 商品相关接口
 *
 * @author java1412
 * @since 2023-07-21 16:24:59
 */
@RestController
@RequestMapping("/api/v1/goods")
public class GoodsController {
    @Resource
    private GoodsService goodsService;

    @RequestMapping("/findByGoodsId")
    public Object findByGoodsId(
            int goodsId
    ) {
        return goodsService.findById(goodsId);
    }

    @RequestMapping("/findClusterName")
    public Object findClusterName(HttpServletRequest request) {
        String clusterName = "当前服务器名称: " + request.getServerName() + ";当前集群节点端口号: " + request.getServerPort();
        return clusterName;
    }
}
